#include <ctime>
#include <iostream>
#include <fstream>
using namespace std;
void Sort(int l[], int Lenght) {
    while(Lenght--) {
        bool mas = false;
        
        for(int i=0; i<Lenght;i++) {
            if(l[i] > l[i+1]) {
                swap(lost[i],l[i+1]);
                mas = true;
            }
        } 
        if(mas == false) break;
    }
void read_from_file(const char *filename, int a[], int length) {
    ifstream file(filename);

    for(int i=0; i < length; i++)
        file >> a[i];
}

int main()
{
  #define LEN 5000
    int a[LEN];
    read_from_file("m1_sorted.txt",a,LEN);
    unsigned int start =  clock(); 
    Sort(a,LEN);
    unsigned int finish = clock(); 
    unsigned int work = finish - start; 
    cout<<"m1_sorted " << work << " milliseconds \n";
    
    read_from_file("m2_reverse.txt",a,LEN);
    t_start =  clock(); 
    Sort(a,LEN);
    finish = clock(); 
    work = finish - start; 
    cout<<"m2_reverse " << work << " milliseconds \n";
    
    read_from_file("m3_shuffle.txt",a,LEN);
    start =  clock(); 
    Sort(a,LEN);
    finish = clock();
    work = finish - start;
    cout<<"m3_shuffle " << work << " milliseconds \n";
    
    return 0;  
}